package org.example.iris.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.Map;

@Repository
public interface InternshipEvaluationMapper {

    /**
     * 插入实习评价记录
     * @param studentId 学生id
     * @param companyId 企业id
     * @param evaluationScore 评价分数
     * @param comments 评价内容
     */
    @Insert("INSERT INTO internship_evaluation (student_id, company_id, evaluation_score, comments) " +
            "VALUES (#{studentId}, #{companyId}, #{evaluationScore}, #{comments})")
    void insertEvaluation(int studentId, int companyId, int evaluationScore, String comments);

    /**
     * 获取某学生对某公司的实习评价
     * @param studentId 学生id
     * @param companyId 企业id
     * @return 评价记录
     */
    @Select("SELECT * FROM internship_evaluation WHERE student_id = #{studentId} AND company_id = #{companyId}")
    Map<String, Object> getEvaluation(int studentId, int companyId);
}
